package cs.rsa.ts14.circuitbreaker.states;

import cs.rsa.ts14.circuitbreaker.CircuitBreaker;
import cs.rsa.ts14.circuitbreaker.exceptions.OpenCircuitException;

public abstract class CircuitBreakerState {

	protected final CircuitBreaker circuitBreaker;

	protected CircuitBreakerState(CircuitBreaker circuitBreaker) {
		this.circuitBreaker = circuitBreaker;
	}

	public void protectedCodeIsAboutToBeCalled() throws OpenCircuitException {}

	public void protectedCodeHasBeenCalled() {}

	public void exceptionOccurred(Exception e) {
		circuitBreaker.increaseFailureCount();
	}
}
